// src/api/apiList/redis.js
import axios from 'axios'

/**
 * 存值到 Redis
 * @param {string} key
 * @param {string} val
 * @returns {Promise<string>} 后端 data 字段，一般是 "ok"
 */
export function saveToRedis(key, val) {
    return axios.post(
        '/RedisController/save',
        null,
        { params: { key, val } }
    )
}

/**
 * 从 Redis 读取值
 * @param {string} key
 * @returns {Promise<string|null>} 后端 data 字段，找不到时为 null
 */
export function loadFromRedis(key) {
    return axios.get(
        '/RedisController/read',
        { params: { key } }
    )
}
